#include "xmppcore/predefinedxmppparsingfactory.h"
#include "xmppcore/presenceparserfactory.h"
#include "xmppcore/messageparserfactory.h"
#include "xmppcore/iqparserfactory.h"
#include "xmppcore/presence.h"
#include "xmppcore/message.h"
#include "xmppcore/iq.h"
#include "xmppcore/errorparserfactory.h"
#include "xmppcore/streamerror.h"
#include "xmppcore/errordetailsparserfactory.h"
#include "xmppcore/stanzaerror.h"

namespace yoohoo_xmppcore {

PredefinedXmppParsingFactory::PredefinedXmppParsingFactory() {
	registerPredefinedParserFactoires();
}

void PredefinedXmppParsingFactory::registerPredefinedParserFactoires() {
	XmppParserFactory* presenceParserFactory = new PresenceParserFactory;
	registerParser(presenceParserFactory, ProtocolRelation(ProtocolKey::NULL_PROTOCOL_KEY, Presence::PROTOCOL_KEY));

	XmppParserFactory* messageParserFactory = new MessageParserFactory;
	registerParser(messageParserFactory, ProtocolRelation(ProtocolKey::NULL_PROTOCOL_KEY, Message::PROTOCOL_KEY));

	XmppParserFactory* iqParserFactory = new IqParserFactory;
	registerParser(iqParserFactory, ProtocolRelation(ProtocolKey::NULL_PROTOCOL_KEY, Iq::PROTOCOL_KEY));

	XmppParserFactory* stanzaErrorParserFactory = new ErrorParserFactory(Error::ErrorTypeStanza);
	registerParser(stanzaErrorParserFactory, ProtocolRelation(ProtocolKey::NULL_PROTOCOL_KEY, StanzaError::PROTOCOL_KEY));

	XmppParserFactory* streamErrorParserFactory = new ErrorParserFactory(Error::ErrorTypeStream);
	registerParser(streamErrorParserFactory, ProtocolRelation(ProtocolKey::NULL_PROTOCOL_KEY, StreamError::PROTOCOL_KEY));

	registerParser(new StanzaErrorDetailsParserFactory, ProtocolRelation(StanzaError::PROTOCOL_KEY, StanzaError::ERROR_DETAIL_PROTOCOL_KEY));
	registerParser(new StreamErrorDetailsParserFactory, ProtocolRelation(StreamError::PROTOCOL_KEY, StreamError::ERROR_DETAIL_PROTOCOL_KEY));
}

}
